<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>打印报销凭证</title>

    <!--引入本地 element-ui 的样式，-->
    <script type="text/javascript" src="/admin/js-css/js/vue.min.js"></script>
    <script type="text/javascript" src="/admin/plugin/element-ui/index.js"></script>

    <!--    引入Layui组件-->
    <script src="/admin/plugin/layui/dist/layui.js" charset="utf-8"></script>

    <script type="text/javascript" src="/admin/js-css/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/admin/js-css/js/mx1.0.js?v=1.1.1"></script>
    <script type="text/javascript" src="/admin/html/module/yumenyoutian/js/api.js"></script>
    <script type="text/javascript" src="/admin/js-css/js/jQuery.print.js?v=1.1"></script>


    <style>
        table tr td
        {border:1px solid black;}

        body{
            font-weight: normal;
        }

        .fontclass{
            font-size: 10px;
        }

        .tdnot_border tr td{
            border: none;
        }
    </style>

</head>
<body>

    <div id="app">
        <template>
            <div>
                <div id="printMe" style="padding: 2px 80px;">
                    <!-- table模块 -->
                    <table
                            border="1"
                            cellpadding="8"
                            style="border-collapse: collapse; width: 100%; font-size: 14px"
                    >
                        <caption>
                            <p style="font-size: 20px;font-weight: bold;" v-if="tableData.nka002 == '1' || tableData.nka002 == '2'">玉门油田员工企业补充医疗保险结算单</p>
                            <p style="font-size: 20px;font-weight: bold;" v-if="tableData.nka002 == '4' || tableData.nka002 == '3'">玉门油田有偿解除劳动合同人员企业补充医疗保险结算单</p>
                            <p style="font-size: 20px;font-weight: bold;" v-if="tableData.nka002 == '6' ">玉门油田供养直系亲属医疗补助结算单</p>
                            <!--<p style="text-align: right">报销日期：{{tableData.kni059_rq}}</p>-->
                            <table border="0" width="100%" class="tdnot_border" >
                                <tr>
                                    <td>
                                        编制单位：公共事务中心医疗保险中心
                                    </td>
                                    <td>
                                        报销日期：{{tableData.kni059_rq}}
                                    </td>
                                    <td style="text-align: right;">
                                        附件张数：{{tableData.fjzs}}
                                    </td>
                                </tr>
                            </table>
                        </caption>
                        <tr class="fontclass" >
                            <td align="center" style="width: 80px">姓名</td>
                            <td align="center">{{ tableData.aac003 || "/" }}</td>
                            <td align="center">性别</td>
                            <td align="center">{{ tableData.aac004_txt || "/" }}</td>
                            <td align="center">身份证号码</td>
                            <td align="center" colspan="2">{{ tableData.aac002 || "/" }}</td>
                            <td align="center">单号</td>
                            <td align="center">{{ tableData.knn001 || "/" }}</td>
                        </tr>
                        <tr class="fontclass" >
                            <td align="center">医保手册号</td>
                            <td align="center">{{ tableData.kcc001 || "/" }}</td>
                            <td align="center">联系方式</td>
                            <td align="center">{{ tableData.aae007 || "/" }}</td>
                            <td align="center">人员类型</td>
                            <td align="center" colspan="2">
                                {{ tableData.nka002_txt || "/" }}
                            </td>
                            <td align="center">年度</td>
                            <td align="center">{{ tableData.aae001 || "/" }}</td>
                        </tr>
                        <tr>
                            <td align="center" rowspan="2" style="font-weight: bold;">门诊基本情况</td>
                            <td align="center" class="fontclass" >总费用</td>
                            <td align="center" class="fontclass" >目录外</td>
                            <td align="center" class="fontclass" >基本医疗报销</td>
                            <td align="center" class="fontclass" >其他</td>
                            <td align="center" class="fontclass" >起付标准</td>
                            <td align="center" colspan="2" class="fontclass" >可报金额</td>
                            <td align="center" class="fontclass" >实际报销金额</td>
                        </tr>
                        <tr class="fontclass" >
                            <td align="center">{{ NumberQfw(tableData.kni035) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni036) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.knz016) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.knz017) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.knz013) || "/" }}</td>
                            <td align="center" colspan="2">{{ NumberQfw(tableData.kni037) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni038) || "/" }}</td>
                        </tr>
                        <tr>
                            <td align="center" rowspan="3" style="font-weight: bold;" >特(慢)病基本情况</td>
                            <td align="center" class="fontclass" >特殊病病种</td>
                            <td align="center" class="fontclass"  colspan="7">{{ tableData.kni043 || "/" }}</td>
                        </tr>
                        <tr class="fontclass" >
                            <td align="center">总费用</td>
                            <td align="center">目录外</td>
                            <td align="center">基本医疗报销</td>
                            <td align="center">大病报销</td>
                            <td align="center">商业保险报销</td>
                            <td align="center">其他</td>
                            <td align="center">可报金额</td>
                            <td align="center">实际报销金额</td>
                        </tr>
                        <tr class="fontclass" >
                            <td align="center">{{ NumberQfw(tableData.kni047) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni048) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni049) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni050) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni051) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni052) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni053) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni054) || "/" }}</td>
                        </tr>
                        <tr class="fontclass" >
                            <td align="center" rowspan="5" style="font-weight: bold;" >住院基本情况</td>
                            <td align="center">医院名称</td>
                            <td align="center" colspan="5">{{ tableData.kni013 || "/" }}</td>
                            <td align="center">住院号</td>
                            <td align="center">{{ tableData.kni006 || "/" }}</td>
                        </tr>
                        <tr class="fontclass" >
                            <td align="center">入院日期</td>
                            <td align="center">{{ tableData.kni008 || "/" }}</td>
                            <td align="center">出院日期</td>
                            <td align="center">{{ tableData.kni009 || "/" }}</td>
                            <td align="center">住院天数</td>
                            <td align="center">{{ tableData.kni010 || "/" }}</td>
                            <td align="center">当年住院次数</td>
                            <td align="center">{{ tableData.kni011 || "/" }}</td>
                        </tr>
                        <tr class="fontclass" >
                            <td align="center">诊断病种</td>
                            <td align="center" colspan="7">{{ tableData.kni007 || "/" }}</td>
                        </tr>
                        <tr class="fontclass" >
                            <td align="center">住院总费用</td>
                            <td align="center">目录外</td>
                            <td align="center">基本医疗报销</td>
                            <td align="center">大病报销</td>
                            <td align="center">商业保险报销</td>
                            <td align="center">其他</td>
                            <td align="center">可报金额</td>
                            <td align="center">实际报销金额</td>
                        </tr>
                        <tr class="fontclass" >
                            <td align="center">{{ NumberQfw(tableData.kni014)  || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni022) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni023) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni024) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni025) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni026) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni027) || "/" }}</td>
                            <td align="center">{{ NumberQfw(tableData.kni028) || "/" }}</td>
                        </tr>
                        <tr  style="font-weight: bold;" >
                            <td align="center" colspan="2" >原始费用合计</td>
                            <td align="center">{{ NumberQfw(zfy) }}</td>
                            <td align="center">可报金额合计</td>
                            <td align="center" colspan="2">{{ NumberQfw(kbje) }}</td>
                            <td align="center">自费金额合计</td>
                            <td align="center" colspan="2">{{ NumberQfw(zfje) }}</td>
                        </tr>
                        <tr  style="font-weight: bold;" >
                            <td align="center" colspan="2">总共报销金额(小写)</td>
                            <td align="center" colspan="2">{{ NumberQfw(sjbx) }}</td>
                            <td align="center" colspan="2">总共报销金额(大写)</td>
                            <td align="center" colspan="3">{{sjbxdx}}</td>
                        </tr>
                        <tr>
                            <td align="center">备注</td>
                            <td align="center" colspan="8">{{tableData.kni056}}</td>
                        </tr>
                    </table>
                    <div class="fontclass"
                         style="display: flex; justify-content: space-around; margin-top: 30px"
                    >
                        <div>中心领导：{{tableData.kni064}}</div>
                        <div>稽核人：{{tableData.kni062}}</div>
                        <div>复核人：{{tableData.kni060}}</div>
                        <div>经办人：{{tableData.kni058}}</div>
                    </div>
                </div>
            </div>
        </template>
    </div>

    <script>

        var vm = new Vue({
           el:"#app",
           data:{
               tableData: {
                   aac003: "",
               },
               // 总费用合计
               zfy: 0,
               // 可报销金额合计
               kbje: 0,
               // 总共报销金额
               sjbx: 0,
               // 自费金额合计
               zfje: 0,
               // 总共报销金额大写
               sjbxdx: '',
               parmsData:{},
           },
           created(){
               this.parmsData = getParams();
               this.getData(this.parmsData.id);
           },
            methods: {
               NumberQfw(str){
                   if(str!="" && "/" != str){
                       let lw = parseFloat(str).toFixed(2);
                       return parseFloat(lw).toLocaleString("en",{ minimumFractionDigits: 2 });
                   }
                   return str;
               },
                printHtml(){
                    $("#printMe").print();
                },
                //   获取表格数据
                async getData(id) {
                    console.log("我是子组件方法");
                    const params = {
                        aic001: id,
                    };
                    const res = await api.queryBody(
                        "/admin/api/mirc/MedicalInsuranceReimbursementController/queryDataForIdReport",
                        params
                    );
                    if (res.code == 1) {
                        this.tableData = res.data;
                        console.log(res.data);
                        this.zfy = res.data.mapsum.z1;
                        this.kbje = res.data.mapsum.z2;
                        this.sjbx = res.data.mapsum.z3;
                        this.zfje = res.data.mapsum.z5;
                        this.sjbxdx = res.data.mapsum.z4;
                    } else {
                        this.$message.error(res.msg);
                    }
                },
                // 将数字转成大写
                convertCurrency(money) {
                    //汉字的数字
                    var cnNums = new Array(
                        "零",
                        "壹",
                        "贰",
                        "叁",
                        "肆",
                        "伍",
                        "陆",
                        "柒",
                        "捌",
                        "玖"
                    ); //基本单位
                    var cnIntRadice = new Array("", "拾", "佰", "仟"); //对应整数部分扩展单位
                    var cnIntUnits = new Array("", "万", "亿", "兆"); //对应小数部分单位
                    var cnDecUnits = new Array("角", "分", "毫", "厘"); //整数金额时后面跟的字符
                    var cnInteger = "整"; //整型完以后的单位
                    var cnIntLast = "元"; //最大处理的数字
                    var maxNum = 999999999999999.9999; //金额整数部分
                    var integerNum; //金额小数部分
                    var decimalNum; //输出的中文金额字符串
                    var chineseStr = ""; //分离金额后用的数组，预定义
                    var parts;
                    if (money == "") {
                        return "";
                    }
                    money = parseFloat(money);
                    if (money >= maxNum) {
                        //超出最大处理数字
                        return "";
                    }
                    if (money == 0) {
                        chineseStr = cnNums[0] + cnIntLast + cnInteger;
                        return chineseStr;
                    } //转换为字符串
                    money = money.toString();
                    if (money.indexOf(".") == -1) {
                        integerNum = money;
                        decimalNum = "";
                    } else {
                        parts = money.split(".");
                        integerNum = parts[0];
                        decimalNum = parts[1].substr(0, 4);
                    } //获取整型部分转换
                    if (parseInt(integerNum, 10) > 0) {
                        var zeroCount = 0;
                        var IntLen = integerNum.length;
                        for (var i = 0; i < IntLen; i++) {
                            var n = integerNum.substr(i, 1);
                            var p = IntLen - i - 1;
                            var q = p / 4;
                            var m = p % 4;
                            if (n == "0") {
                                zeroCount++;
                            } else {
                                if (zeroCount > 0) {
                                    chineseStr += cnNums[0];
                                } //归零
                                zeroCount = 0;
                                chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
                            }
                            if (m == 0 && zeroCount < 4) {
                                chineseStr += cnIntUnits[q];
                            }
                        }
                        chineseStr += cnIntLast;
                    } //小数部分
                    if (decimalNum != "") {
                        var decLen = decimalNum.length;
                        for (var i = 0; i < decLen; i++) {
                            var n = decimalNum.substr(i, 1);
                            if (n != "0") {
                                chineseStr += cnNums[Number(n)] + cnDecUnits[i];
                            }
                        }
                    }
                    if (chineseStr == "") {
                        chineseStr += cnNums[0] + cnIntLast + cnInteger;
                    } else if (decimalNum == "") {
                        chineseStr += cnInteger;
                    }
                    return chineseStr;
                },
                //   打印方法
                goPrint() {
                    printJS({
                        printable: "printMe",
                        type: "html",
                        // properties: [
                        //    { field: 'name', displayName: '姓名', columnSize:`50%`},
                        //    { field: 'sex', displayName: '性别',columnSize:`50%`},
                        // ],
                        // header: `<div style="font-size:30px;text-align:center;"> 玉门油田企业员工补充医疗保险结算单 </div>`,
                        style: '@media print{@page {size:landscape}}',
                        // gridHeaderStyle:'font-size:12px; padding:3px; border:1px solid; font-weight: 100; text-align:left;',
                        // gridStyle:'font-size:12px; padding:3px; border:1px solid; text-align:left;',
                        // repeatTableHeader: true,
                        scanStyles: false,
                        targetStyles: ["*"],
                        ignoreElements: ["no-print"],
                    });
                },
                // 关闭窗口
                handleClose() {
                    this.remoteClose();
                },
            },
        });
    </script>
</body>
</html>